/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
import java.util.Scanner;

/**
 * <p>Project: jse2302 - Reader
 * <p>Powered by webrx On 2023-06-30 14:44:15
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Reader implements Runnable {
    private Socket socket = null;

    public Reader(Socket socket) {
        this.socket = socket;
    }

    public Reader() {
    }

    @Override
    public void run() {
        try {
            InputStream is = this.socket.getInputStream();
            InputStreamReader isr = new InputStreamReader(is);
            BufferedReader read = new BufferedReader(isr);
            while (true) {
                //接收s.getInputStream();
                System.out.println(read.readLine());
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
